package mvc.views.mediators
{
	import flash.display.Stage;
	
	import globals.Config;
	import globals.Global;
	
	import mvc.Notifications;
	import mvc.models.VOs.OperationListVO;
	import mvc.views.frames.FrameLogin;
	import mvc.views.frames.FrameMain;
	import mvc.views.frames.FrameOperationList;
	import mvc.views.frames.FramePanel;
	import mvc.views.layers.UILayer;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	import utils.UtilsAnimation;
	
	import xl.utils.Tracker;
	
	public class MediatorMainContent extends Mediator implements IMediator
	{
		public static const NAME:String = "MediatorMainContent";
		private var _frame:FrameMain=null;
		
		public function MediatorMainContent(mediatorName:String=null, viewComponent:Object=null)
		{
			super(mediatorName, viewComponent);
		}
		
		override public function listNotificationInterests():Array
		{
			// TODO Auto Generated method stub
			return [
				Notifications.MEDIATOR_SELECT_MAIN,
				Notifications.MEDIATOR_UPDATE_MAIN_DATA
			];
		}
		
		override public function handleNotification(notification:INotification):void
		{
			// TODO Auto Generated method stub
			super.handleNotification(notification);
			
			switch(notification.getName())
			{
				case Notifications.MEDIATOR_SELECT_MAIN:
					if(!_frame)
					{
						_frame = new FrameMain();
						UtilsAnimation.showFrameStyle1(_frame);
						Global.uiLayer.addElement(_frame);
						_frame.x = Config.mainContentX;
						_frame.y = Config.headerHeight;
					}
					_frame.updateTabs(notification.getBody() as OperationListVO);
					break;
				case Notifications.MEDIATOR_UPDATE_MAIN_DATA:
					break;
			}
		}
		
		
	}
}